|
|
|
|
|
|
|
Figure 10.22
A depth two type A curve
made up of four level-one curves. |
|
|
|
|
|
|
|
|
Figure 10.22 shows how level-one curves make up a level-two type A curve. Figure 10.23 shows how 16 level-one curves make up a complete level-two Sierpinski curve. Each of the level-two subcurves is circled with dashed lines so that it is easy to see. |
|
|
|
|
|
|
|
|
If you use arrows to indicate the types of lines that connect the subcurves (the thin lines in Figures 10.22 and 10.23), you can list the recursive relationships among the four types of curves, as shown in Figure 10.24. |
|
|
|
|
|
|
|
|
The routines that draw the Sierpinski subcurves are all very similar, so only one is shown here. Figure 10.24 shows how to combine smaller curves to form larger ones. You can follow the steps in Figure 10.24 for drawing a type A curve in the following code. You can use the other relationships to reproduce the other curve-drawing routines. |
|
|
|
 |
|
|
|
|
' Draw a type A sierpinski sub-curve. Private Sub SierpA(ByVal depth As Integer, _
ByVal dist As Single)
If depth = 1 Then
picCanvas.Line -Step(-dist, dist)
picCanvas.Line -Step(-dist, 0)
picCanvas.Line -Step(-dist, -dist)
Else
SierpA depth - 1, dist
picCanvas.Line -Step(-dist, dist)
SierpB depth - 1, dist |
|
|
|
|
|
|
|
|
Figure 10.23
A complete depth two Sierpinski curve
made up of depth one curves. |
|
|
|
|
|